#include<iostream>
using namespace std;


class Task
{
public:
  Task(){} //默认构造函数
  Task(int x,int y,int op)
    :_x(x),_y(y),_op(op)
  {}
  ~Task()
  {}
  void Run()
  {
    int res = 0; 
    switch(_op)
    {
      case '+':
        res = _x + _y;
        break;
      case '-':
        res = _x - _y;
        break;
      case '*':
        res = _x * _y;
        break;
      case '/':
        if(_y == 0)
        {
          cout <<"右操作数不能为0  err...." << endl;
          res = -1;
        }
        else 
        {
          res = _x / _y;
        }
         break;
      case '%':
        if(_y == 0)
        {
          cout <<"右操作数不能为0   err...." << endl;
          res = -1;
        }
        else 
        {
          res = _x % _y;
        }
        break;
      default:
        cout << "运算符operation err ...." << endl;
        break;
    }
    cout << "任务执行结果为: "<< _x << " " << _op <<" " << _y << " = "<<res << endl;
  }
  void operator()()
  {
    Run();
  }
private:
  int _x;
  int _y;
  char _op;
};
